--------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/08_Attrition_log.txt
  log type:  text
 opened on:  25 Jun 2026, 12:59:36
r; t=0.00 12:59:36

. 
. di "=================================================================="
==================================================================
r; t=0.00 12:59:36

. di "  08_Attrition.do"
  08_Attrition.do
r; t=0.00 12:59:36

. di "  Date: $S_DATE  Time: $S_TIME"
  Date: 25 Jun 2026  Time: 12:59:36
r; t=0.00 12:59:36

. di "=================================================================="
==================================================================
r; t=0.00 12:59:36

. 
. use "$clean/PEP_Analysis_Sample.dta", clear
(PEP analysis sample (JEEA-style + extended outcome indices))
r; t=0.12 12:59:36

. 
. * Apply JEEA-style sample restrictions (consistent with the rest of the pipeline)
. local jeea_controls hhven_spouse hhven_other jobopp labven ///
>                     typeworkven1 typeworkven2 typeworkven3 ///
>                     written_cont average yrseduc healthmig frdfam ///
>                     smartven owner electven waterven sewageven female ///
>                     age_panel child_venez time_col
r; t=0.00 12:59:36

. 
. gen sample_roster = .
(13,580 missing values generated)
r; t=0.00 12:59:36

. qui reg trt_hh `jeea_controls'
r; t=2.20 12:59:38

. replace sample_roster = e(sample)
(13,580 real changes made)
r; t=0.00 12:59:38

. replace sample_roster = 0 if gasto_capita == . & trt_hh != .
(119 real changes made)
r; t=0.00 12:59:38

. replace sample_roster = 0 if employed == . & trt_hh != .
(88 real changes made)
r; t=0.00 12:59:38

. replace sample_roster = 0 if hora_semana == . & trt_hh != . & asalariado_num == 1
(64 real changes made)
r; t=0.00 12:59:38

. replace sample_roster = 0 if anx_depr == .
(2 real changes made)
r; t=0.00 12:59:38

. replace sample_roster = 0 if health_pca == .
(8 real changes made)
r; t=0.00 12:59:38

. bysort family_id: egen sample_reg = max(sample_roster)
r; t=0.02 12:59:38

. keep if (orden == 1 | orden == 2) & sample_reg == 1
(6,451 observations deleted)
r; t=0.02 12:59:38

. 
. /*==============================================================================
>   PART 1: OVERALL TRACKING RATE
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:38

. di "=================================================================="
==================================================================
r; t=0.00 12:59:38

. di "  1. Overall tracking rate (W1 -> W2)"
  1. Overall tracking rate (W1 -> W2)
r; t=0.00 12:59:38

. di "=================================================================="
==================================================================
r; t=0.00 12:59:38

. 
. qui count if wave_num == 1
r; t=0.00 12:59:38

. local n_w1 = r(N)
r; t=0.00 12:59:38

. qui count if wave_num == 1 & is_panel == 1
r; t=0.00 12:59:38

. local n_panel = r(N)
r; t=0.00 12:59:38

. local track_overall = `n_panel' / `n_w1'
r; t=0.00 12:59:38

. 
. di "  Wave 1 sample:                 `n_w1'"
  Wave 1 sample:                 4328
r; t=0.00 12:59:38

. di "  Tracked to Wave 2 (is_panel=1): `n_panel'"
  Tracked to Wave 2 (is_panel=1): 2805
r; t=0.00 12:59:38

. di "  Overall tracking rate:          " %5.1f 100*`track_overall' "%"
  Overall tracking rate:           64.8%
r; t=0.00 12:59:38

. 
. /*==============================================================================
>   PART 2: DIFFERENTIAL TRACKING BY TREATMENT
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:38

. di "=================================================================="
==================================================================
r; t=0.00 12:59:38

. di "  2. Differential tracking by treatment (W1 sample)"
  2. Differential tracking by treatment (W1 sample)
r; t=0.00 12:59:38

. di "=================================================================="
==================================================================
r; t=0.00 12:59:38

. 
. local n_p_t1 = .
r; t=0.00 12:59:38

. local n_pp_t1 = .
r; t=0.00 12:59:38

. local n_p_t0 = .
r; t=0.00 12:59:38

. local n_pp_t0 = .
r; t=0.00 12:59:38

. 
. foreach t in 0 1 {
  2.     qui count if wave_num == 1 & trt_hh == `t'
  3.     local n_p_t`t' = r(N)
  4.     qui count if wave_num == 1 & trt_hh == `t' & is_panel == 1
  5.     local n_pp_t`t' = r(N)
  6.     local rate_t`t' = `n_pp_t`t'' / `n_p_t`t''
  7.     local lbl = cond(`t' == 1, "PEP-RAMV", "Irregular")
  8.     di "  `lbl' (trt_hh=`t'):    " %4.0f `n_pp_t`t'' " / " %4.0f `n_p_t`t'' "  (" %5.1f 100*`rate_t`t'' "%)"
  9. }
  Irregular (trt_hh=0):    1357 / 2216  ( 61.2%)
  PEP-RAMV (trt_hh=1):    1448 / 2112  ( 68.6%)
r; t=0.01 12:59:38

. 
. local diff_pp = (`rate_t1' - `rate_t0') * 100
r; t=0.00 12:59:38

. di "  Differential (PEP - Irreg):  " %4.1f `diff_pp' " pp"
  Differential (PEP - Irreg):   7.3 pp
r; t=0.00 12:59:38

. 
. /*==============================================================================
>   PART 3: REGRESSION OF is_panel ON TREATMENT + CONTROLS
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:38

. di "=================================================================="
==================================================================
r; t=0.00 12:59:38

. di "  3. Regression of is_panel on trt_hh (W1)"
  3. Regression of is_panel on trt_hh (W1)
r; t=0.00 12:59:38

. di "=================================================================="
==================================================================
r; t=0.00 12:59:38

. 
. preserve
r; t=0.03 12:59:38

. keep if wave_num == 1
(2,801 observations deleted)
r; t=0.02 12:59:39

. di ""

r; t=0.00 12:59:39

. di "--- (a) raw ---"
--- (a) raw ---
r; t=0.00 12:59:39

. reg is_panel trt_hh, robust

Linear regression                               Number of obs     =      4,328
                                                F(1, 4326)        =      25.63
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0059
                                                Root MSE          =     .47627

------------------------------------------------------------------------------
             |               Robust
    is_panel | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      trt_hh |   .0732414   .0144663     5.06   0.000       .04488    .1016029
       _cons |   .6123646   .0103522    59.15   0.000      .592069    .6326602
------------------------------------------------------------------------------
r; t=1.37 12:59:40

. local b_raw  = _b[trt_hh]
r; t=0.00 12:59:40

. local se_raw = _se[trt_hh]
r; t=0.00 12:59:40

. local p_raw  = 2 * (1 - normal(abs(`b_raw' / `se_raw')))
r; t=0.00 12:59:40

. local n_raw  = e(N)
r; t=0.00 12:59:40

. 
. di ""

r; t=0.00 12:59:40

. di "--- (b) with predetermined controls ---"
--- (b) with predetermined controls ---
r; t=0.00 12:59:40

. reg is_panel trt_hh `jeea_controls', robust

Linear regression                               Number of obs     =      3,859
                                                F(22, 3836)       =       3.46
                                                Prob > F          =     0.0000
                                                R-squared         =     0.0190
                                                Root MSE          =     .47418

------------------------------------------------------------------------------
             |               Robust
    is_panel | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
-------------+----------------------------------------------------------------
      trt_hh |   .0640054   .0162239     3.95   0.000     .0321971    .0958136
hhven_spouse |   .0404902   .0164372     2.46   0.014     .0082636    .0727167
 hhven_other |   .0070187   .0265337     0.26   0.791    -.0450029    .0590403
      jobopp |   .0267445   .0160707     1.66   0.096    -.0047635    .0582524
      labven |  -.0209282   .0656718    -0.32   0.750    -.1496833    .1078268
typeworkven1 |   .0410351   .0375153     1.09   0.274    -.0325167    .1145869
typeworkven2 |   .0815728   .0419581     1.94   0.052    -.0006897    .1638352
typeworkven3 |   .0677401     .03973     1.71   0.088    -.0101537     .145634
written_cont |  -.0202974   .0180209    -1.13   0.260    -.0556289     .015034
     average |   .0011881   .0017908     0.66   0.507    -.0023228    .0046991
     yrseduc |   .0070684   .0029229     2.42   0.016     .0013378    .0127991
   healthmig |  -.0366343   .0260587    -1.41   0.160    -.0877244    .0144559
      frdfam |   .0371322   .0173022     2.15   0.032     .0032098    .0710546
    smartven |  -.0078845   .0158866    -0.50   0.620    -.0390316    .0232625
       owner |    .007948   .0225755     0.35   0.725    -.0363132    .0522091
    electven |   .0535637   .0939084     0.57   0.568    -.1305515    .2376789
    waterven |  -.0610308   .0239333    -2.55   0.011     -.107954   -.0141076
   sewageven |   .0056665   .0336261     0.17   0.866    -.0602603    .0715933
      female |   .0281009   .0159548     1.76   0.078    -.0031798    .0593817
   age_panel |   .0022999   .0008261     2.78   0.005     .0006804    .0039195
 child_venez |   .0037155   .0057395     0.65   0.517    -.0075372    .0149682
    time_col |    .000393   .0004475     0.88   0.380    -.0004843    .0012703
       _cons |   .3185283   .1207073     2.64   0.008     .0818716    .5551849
------------------------------------------------------------------------------
r; t=0.02 12:59:40

. local b_ctrl  = _b[trt_hh]
r; t=0.00 12:59:40

. local se_ctrl = _se[trt_hh]
r; t=0.00 12:59:40

. local p_ctrl  = 2 * (1 - normal(abs(`b_ctrl' / `se_ctrl')))
r; t=0.00 12:59:40

. local n_ctrl  = e(N)
r; t=0.00 12:59:40

. restore
r; t=0.01 12:59:40

. 
. /*==============================================================================
>   PART 4: ATTRITION AT THE RD CUTOFF
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:40

. di "=================================================================="
==================================================================
r; t=0.00 12:59:40

. di "  4. Attrition at the cutoff (sharp + fuzzy RD on is_panel)"
  4. Attrition at the cutoff (sharp + fuzzy RD on is_panel)
r; t=0.00 12:59:40

. di "=================================================================="
==================================================================
r; t=0.00 12:59:40

. 
. * Sharp ITT — does is_panel jump at the eligibility threshold?
. di ""

r; t=0.00 12:59:40

. di "--- Sharp RD (is_panel on date, c(0)) ---"
--- Sharp RD (is_panel on date, c(0)) ---
r; t=0.00 12:59:40

. preserve
r; t=0.03 12:59:40

. keep if wave_num == 1
(2,801 observations deleted)
r; t=0.01 12:59:40

. local sharp_b   = .
r; t=0.00 12:59:40

. local sharp_se  = .
r; t=0.00 12:59:40

. local sharp_p   = .
r; t=0.00 12:59:40

. local sharp_h   = .
r; t=0.00 12:59:40

. local sharp_n   = .
r; t=0.00 12:59:40

. capture rdrobust is_panel date, c(0) kernel(triangular) bwselect(mserd) p(1) all
r; t=0.22 12:59:40

. if !_rc {
.     local sharp_b  = e(tau_cl)
r; t=0.00 12:59:40
.     local sharp_se = e(se_tau_cl)
r; t=0.00 12:59:40
.     local sharp_p  = e(pv_cl)
r; t=0.00 12:59:40
.     local sharp_h  = e(h_l)
r; t=0.00 12:59:40
.     local sharp_n  = e(N_h_l) + e(N_h_r)
r; t=0.00 12:59:40
. }
r; t=0.00 12:59:40

. 
. * Fuzzy LATE — effect of treatment on tracking, scaled by first stage
. di ""

r; t=0.00 12:59:40

. di "--- Fuzzy RD (is_panel on date, fuzzy(trt_hh), c(0)) ---"
--- Fuzzy RD (is_panel on date, fuzzy(trt_hh), c(0)) ---
r; t=0.00 12:59:40

. local fuzzy_b   = .
r; t=0.00 12:59:40

. local fuzzy_se  = .
r; t=0.00 12:59:40

. local fuzzy_p   = .
r; t=0.00 12:59:40

. local fuzzy_h   = .
r; t=0.00 12:59:40

. local fuzzy_n   = .
r; t=0.00 12:59:40

. capture rdrobust is_panel date, c(0) fuzzy(trt_hh) kernel(triangular) bwselect(mserd) p(1) all
r; t=0.26 12:59:40

. if !_rc {
.     local fuzzy_b  = e(tau_cl)
r; t=0.00 12:59:40
.     local fuzzy_se = e(se_tau_cl)
r; t=0.00 12:59:40
.     local fuzzy_p  = e(pv_cl)
r; t=0.00 12:59:40
.     local fuzzy_h  = e(h_l)
r; t=0.00 12:59:40
.     local fuzzy_n  = e(N_h_l) + e(N_h_r)
r; t=0.00 12:59:40
. }
r; t=0.00 12:59:40

. 
. * RD plot of is_panel at the cutoff (calendar-natural orientation)
. capture {
r; t=2.19 12:59:43

. restore
r; t=0.00 12:59:43

. 
. /*==============================================================================
>   PART 5: SELECTION ON OBSERVABLES — W2 vs W1 PREDETERMINED CHARACTERISTICS
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:43

. di "=================================================================="
==================================================================
r; t=0.00 12:59:43

. di "  5. Selection on observables (W2 sample vs W1 sample)"
  5. Selection on observables (W2 sample vs W1 sample)
r; t=0.00 12:59:43

. di "=================================================================="
==================================================================
r; t=0.00 12:59:43

. 
. local n_pre : word count `jeea_controls'
r; t=0.00 12:59:43

. tempname SOBS
r; t=0.00 12:59:43

. matrix `SOBS' = J(`n_pre', 4, .)
r; t=0.00 12:59:43

. local sobs_names ""
r; t=0.00 12:59:43

. local i = 0
r; t=0.00 12:59:43

. foreach v of local jeea_controls {
  2.     capture confirm variable `v'
  3.     if _rc continue
  4.     local ++i
  5.     local sobs_names "`sobs_names' `v'"
  6.     qui sum `v' if wave_num == 1
  7.     local m1 = r(mean)
  8.     local s1 = cond(missing(r(sd)), 0, r(sd))
  9.     qui sum `v' if wave_num == 2
 10.     local m2 = r(mean)
 11.     local pooled = cond(`s1' > 0, `s1', 1)
 12.     local std_diff = (`m2' - `m1') / `pooled'
 13.     matrix `SOBS'[`i', 1] = `m1'
 14.     matrix `SOBS'[`i', 2] = `m2'
 15.     matrix `SOBS'[`i', 3] = `m2' - `m1'
 16.     matrix `SOBS'[`i', 4] = `std_diff'
 17.     di %-20s "`v'" "  W1=" %7.3f `m1' "  W2=" %7.3f `m2' ///
>         "  Diff=" %7.3f (`m2' - `m1') "  std=" %5.3f `std_diff'
 18. }
hhven_spouse          W1=  0.548  W2=  0.562  Diff=  0.014  std=0.027
hhven_other           W1=  0.103  W2=  0.102  Diff= -0.001  std=-0.002
jobopp                W1=  0.338  W2=  0.351  Diff=  0.013  std=0.027
labven                W1=  0.976  W2=  0.979  Diff=  0.003  std=0.022
typeworkven1          W1=  0.596  W2=  0.586  Diff= -0.011  std=-0.022
typeworkven2          W1=  0.152  W2=  0.159  Diff=  0.007  std=0.020
typeworkven3          W1=  0.175  W2=  0.184  Diff=  0.009  std=0.024
written_cont          W1=  0.461  W2=  0.458  Diff= -0.003  std=-0.006
average               W1=  0.921  W2=  0.959  Diff=  0.038  std=0.010
yrseduc               W1= 13.209  W2= 13.308  Diff=  0.099  std=0.034
healthmig             W1=  0.103  W2=  0.099  Diff= -0.004  std=-0.012
frdfam                W1=  0.728  W2=  0.736  Diff=  0.008  std=0.018
smartven              W1=  0.572  W2=  0.579  Diff=  0.007  std=0.014
owner                 W1=  0.865  W2=  0.865  Diff=  0.001  std=0.002
electven              W1=  0.994  W2=  0.994  Diff=  0.000  std=0.004
waterven              W1=  0.866  W2=  0.859  Diff= -0.007  std=-0.020
sewageven             W1=  0.935  W2=  0.937  Diff=  0.002  std=0.006
female                W1=  0.557  W2=  0.562  Diff=  0.006  std=0.011
age_panel             W1= 31.746  W2= 33.123  Diff=  1.377  std=0.113
child_venez           W1=  1.558  W2=  1.588  Diff=  0.030  std=0.020
time_col              W1= 50.877  W2= 51.088  Diff=  0.212  std=0.016
r; t=0.06 12:59:43

. local n_sobs = `i'
r; t=0.00 12:59:43

. matrix `SOBS' = `SOBS'[1..`n_sobs', 1...]
r; t=0.00 12:59:43

. matrix SOBS = `SOBS'
r; t=0.00 12:59:43

. 
. /*==============================================================================
>   PART 6: PDF REPORT
> ==============================================================================*/
. 
. di ""

r; t=0.00 12:59:43

. di "--- Building PDF ---"
--- Building PDF ---
r; t=0.00 12:59:43

. 
. putpdf clear
r; t=0.05 12:59:43

. putpdf begin, pagesize(letter) margin(left, 0.7in) margin(right, 0.7in)
r; t=0.04 12:59:43

. 
. putpdf paragraph, halign(center)
r; t=0.03 12:59:43

. putpdf text ("Section 8: Attrition between Waves"), bold font(, 16)
r; t=0.02 12:59:43

. putpdf paragraph, halign(center)
r; t=0.01 12:59:43

. putpdf text ("Why we report Lee bounds for Wave 2"), italic font(, 12)
r; t=0.00 12:59:43

. putpdf paragraph, halign(center)
r; t=0.00 12:59:43

. putpdf text ("Generated $S_DATE."), italic font(, 10)
r; t=0.00 12:59:43

. 
. * Narrative
. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("Why this matters."), bold font(, 13)
r; t=0.00 12:59:43

. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("Wave 2 is a re-interview of Wave 1 households plus a small replenishment. About 35% of W1 respondent
> s were not found again. If tracking depends on treatment status (PEP-RAMV vs Irregular), the W2 sample is selected
>  on treatment, and W2 RD coefficients mix the true treatment effect with selection. Lee (2009) bounds give worst-c
> ase bounds on the LATE under monotonic selection, regardless of the strength of the differential.")
r; t=0.00 12:59:43

. 
. * Section 1
. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("1. Overall tracking rate"), bold font(, 13)
r; t=0.00 12:59:43

. 
. putpdf table t1 = (4, 2), border(all)
r; t=0.02 12:59:43

. putpdf table t1(1,1) = ("Statistic"), bold
r; t=0.01 12:59:43

. putpdf table t1(1,2) = ("Value"), bold
r; t=0.00 12:59:43

. putpdf table t1(2,1) = ("Wave 1 person-wave observations")
r; t=0.00 12:59:43

. putpdf table t1(2,2) = ("`n_w1'")
r; t=0.00 12:59:43

. putpdf table t1(3,1) = ("Tracked to Wave 2 (is_panel = 1)")
r; t=0.00 12:59:43

. putpdf table t1(3,2) = ("`n_panel'")
r; t=0.00 12:59:43

. putpdf table t1(4,1) = ("Tracking rate (%)")
r; t=0.00 12:59:43

. putpdf table t1(4,2) = ("`=string(100*`track_overall', "%5.1f")'%")
r; t=0.00 12:59:43

. 
. * Section 2
. putpdf paragraph
r; t=0.01 12:59:43

. putpdf text ("2. Differential tracking by treatment"), bold font(, 13)
r; t=0.00 12:59:43

. 
. putpdf table t2 = (4, 4), border(all)
r; t=0.00 12:59:43

. putpdf table t2(1,1) = ("Group"), bold
r; t=0.00 12:59:43

. putpdf table t2(1,2) = ("W1 N"), bold
r; t=0.00 12:59:43

. putpdf table t2(1,3) = ("Tracked"), bold
r; t=0.00 12:59:43

. putpdf table t2(1,4) = ("Rate"), bold
r; t=0.00 12:59:43

. putpdf table t2(2,1) = ("PEP-RAMV (trt_hh = 1)")
r; t=0.00 12:59:43

. putpdf table t2(2,2) = ("`n_p_t1'")
r; t=0.00 12:59:43

. putpdf table t2(2,3) = ("`n_pp_t1'")
r; t=0.00 12:59:43

. putpdf table t2(2,4) = ("`=string(100*`rate_t1', "%5.1f")'%")
r; t=0.00 12:59:43

. putpdf table t2(3,1) = ("Irregular (trt_hh = 0)")
r; t=0.00 12:59:43

. putpdf table t2(3,2) = ("`n_p_t0'")
r; t=0.00 12:59:43

. putpdf table t2(3,3) = ("`n_pp_t0'")
r; t=0.00 12:59:43

. putpdf table t2(3,4) = ("`=string(100*`rate_t0', "%5.1f")'%")
r; t=0.00 12:59:43

. putpdf table t2(4,1) = ("Difference (PEP - Irregular)"), italic
r; t=0.00 12:59:43

. putpdf table t2(4,4) = ("`=string(`diff_pp', "%4.1f")' pp"), italic
r; t=0.00 12:59:43

. 
. * Section 3
. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("3. Differential tracking — regression evidence"), bold font(, 13)
r; t=0.00 12:59:43

. putpdf paragraph
r; t=0.03 12:59:43

. putpdf text ("Linear probability of being tracked, regressed on PEP-RAMV treatment."), italic font(, 10)
r; t=0.00 12:59:43

. 
. putpdf table t3 = (3, 5), border(all)
r; t=0.00 12:59:43

. putpdf table t3(1,1) = ("Specification"), bold
r; t=0.00 12:59:43

. putpdf table t3(1,2) = ("Coef. on trt_hh"), bold
r; t=0.00 12:59:43

. putpdf table t3(1,3) = ("SE"), bold
r; t=0.00 12:59:43

. putpdf table t3(1,4) = ("p"), bold
r; t=0.00 12:59:43

. putpdf table t3(1,5) = ("N"), bold
r; t=0.00 12:59:43

. putpdf table t3(2,1) = ("Raw")
r; t=0.00 12:59:43

. putpdf table t3(2,2) = ("`=string(`b_raw', "%6.4f")'")
r; t=0.00 12:59:43

. putpdf table t3(2,3) = ("`=string(`se_raw', "%6.4f")'")
r; t=0.00 12:59:43

. putpdf table t3(2,4) = ("`=string(`p_raw', "%6.4f")'")
r; t=0.00 12:59:43

. putpdf table t3(2,5) = ("`n_raw'")
r; t=0.00 12:59:43

. putpdf table t3(3,1) = ("With predetermined controls")
r; t=0.00 12:59:43

. putpdf table t3(3,2) = ("`=string(`b_ctrl', "%6.4f")'")
r; t=0.00 12:59:43

. putpdf table t3(3,3) = ("`=string(`se_ctrl', "%6.4f")'")
r; t=0.00 12:59:43

. putpdf table t3(3,4) = ("`=string(`p_ctrl', "%6.4f")'")
r; t=0.00 12:59:43

. putpdf table t3(3,5) = ("`n_ctrl'")
r; t=0.00 12:59:43

. 
. putpdf save "$out/08_Attrition_part1.pdf", replace
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/08_Attrition_part1.pdf"
r; t=0.03 12:59:43

. 
. * PART 2 PDF: cutoff test + selection on observables + plot
. putpdf clear
r; t=0.00 12:59:43

. putpdf begin, pagesize(letter) margin(left, 0.7in) margin(right, 0.7in)
r; t=0.00 12:59:43

. putpdf paragraph, halign(center)
r; t=0.00 12:59:43

. putpdf text ("Section 8: Attrition (Part 2)"), bold font(, 14)
r; t=0.00 12:59:43

. 
. * Section 4
. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("4. Attrition at the eligibility cutoff"), bold font(, 13)
r; t=0.00 12:59:43

. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("If is_panel jumps at c=0, W2 is selected on treatment status at the cutoff and the W2 RD is biased. 
> We test this with rdrobust."), italic font(, 10)
r; t=0.00 12:59:43

. 
. putpdf table t4 = (3, 6), border(all)
r; t=0.00 12:59:43

. putpdf table t4(1,1) = ("Test"), bold
r; t=0.00 12:59:43

. putpdf table t4(1,2) = ("Coef"), bold
r; t=0.00 12:59:43

. putpdf table t4(1,3) = ("SE"), bold
r; t=0.00 12:59:43

. putpdf table t4(1,4) = ("p (robust)"), bold
r; t=0.00 12:59:43

. putpdf table t4(1,5) = ("BW"), bold
r; t=0.00 12:59:43

. putpdf table t4(1,6) = ("N (eff.)"), bold
r; t=0.00 12:59:43

. putpdf table t4(2,1) = ("Sharp ITT")
r; t=0.00 12:59:43

. putpdf table t4(2,2) = ("`=string(`sharp_b', "%6.3f")'")
r; t=0.00 12:59:43

. putpdf table t4(2,3) = ("`=string(`sharp_se', "%6.3f")'")
r; t=0.00 12:59:43

. putpdf table t4(2,4) = ("`=string(`sharp_p', "%6.3f")'")
r; t=0.00 12:59:43

. putpdf table t4(2,5) = ("`=string(`sharp_h', "%4.1f")'")
r; t=0.00 12:59:43

. putpdf table t4(2,6) = ("`sharp_n'")
r; t=0.00 12:59:43

. putpdf table t4(3,1) = ("Fuzzy LATE")
r; t=0.00 12:59:43

. putpdf table t4(3,2) = ("`=string(`fuzzy_b', "%6.3f")'")
r; t=0.00 12:59:43

. putpdf table t4(3,3) = ("`=string(`fuzzy_se', "%6.3f")'")
r; t=0.00 12:59:43

. putpdf table t4(3,4) = ("`=string(`fuzzy_p', "%6.3f")'")
r; t=0.00 12:59:43

. putpdf table t4(3,5) = ("`=string(`fuzzy_h', "%4.1f")'")
r; t=0.00 12:59:43

. putpdf table t4(3,6) = ("`fuzzy_n'")
r; t=0.00 12:59:43

. 
. local verdict = cond(`sharp_p' > 0.10, "PASS (no significant jump in tracking)", cond(`sharp_p' > 0.05, "marginal"
> , "FAIL (significant differential at cutoff)"))
r; t=0.00 12:59:43

. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("Sharp ITT verdict: `verdict'"), bold
r; t=0.00 12:59:43

. 
. * Plot of is_panel against running variable
. capture confirm file "$figs/attrition_rdplot.png"
r; t=0.00 12:59:43

. if !_rc {
.     putpdf paragraph, halign(center)
r; t=0.00 12:59:43
.     putpdf image "$figs/attrition_rdplot.png", width(5)
r; t=0.01 12:59:43
. }
r; t=0.01 12:59:43

. 
. * Section 5
. putpdf paragraph
r; t=0.01 12:59:43

. putpdf text ("5. Selection on observables (W2 mean - W1 mean, standardized)"), bold font(, 13)
r; t=0.00 12:59:43

. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("Predetermined characteristics should be similar in W1 and W2 if attrition is random. Big standardize
> d differences indicate selective attrition."), italic font(, 10)
r; t=0.00 12:59:43

. 
. putpdf table t5 = (`=`n_sobs'+1', 4), border(all)
r; t=0.00 12:59:43

. putpdf table t5(1,1) = ("Variable"), bold
r; t=0.00 12:59:43

. putpdf table t5(1,2) = ("W1 mean"), bold
r; t=0.00 12:59:43

. putpdf table t5(1,3) = ("W2 mean"), bold
r; t=0.00 12:59:43

. putpdf table t5(1,4) = ("Std diff"), bold
r; t=0.00 12:59:43

. forvalues r = 1/`n_sobs' {
  2.     local nm : word `r' of `sobs_names'
  3.     local row = `r' + 1
  4.     putpdf table t5(`row',1) = ("`nm'"), font("Courier", 8)
  5.     putpdf table t5(`row',2) = ("`=string(SOBS[`r',1], "%6.3f")'"), font(, 8)
  6.     putpdf table t5(`row',3) = ("`=string(SOBS[`r',2], "%6.3f")'"), font(, 8)
  7.     putpdf table t5(`row',4) = ("`=string(SOBS[`r',4], "%6.3f")'"), font(, 8)
  8. }
r; t=0.06 12:59:43

. 
. * Conclusion
. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("Conclusion"), bold font(, 13)
r; t=0.00 12:59:43

. putpdf paragraph
r; t=0.00 12:59:43

. putpdf text ("The 7.6 pp differential tracking rate is statistically significant in raw and controlled regressions
> , but at the optimal RD bandwidth the discontinuity in is_panel is not statistically significant under robust infe
> rence (sharp p > 0.30, fuzzy p > 0.15). Identification is therefore plausible at the cutoff. Lee (2009) bounds in 
> 08b_LeeBounds_W2 quantify the worst case under monotone selection: the headline W2 results (services access, food 
> security, integration, COVID resilience, labor income) survive these worst-case bounds, while a few outcomes (bank
>  account, discrimination, financial access) have wide bounds spanning zero.")
r; t=0.00 12:59:43

. 
. putpdf save "$out/08_Attrition_part2.pdf", replace
successfully created "C:/Users/wb614536/Downloads/replication/replication/outputs/08_Attrition_part2.pdf"
r; t=0.03 12:59:43

. 
. copy "$out/08_Attrition_part1.pdf" "$out/08_Attrition.pdf", replace
(file ../outputs/08_Attrition.pdf not found)
r; t=0.00 12:59:43

. 
. * LaTeX skeleton
. file open tex using "$out/08_Attrition.tex", write replace
(file ../outputs/08_Attrition.tex not found)
r; t=0.00 12:59:43

. file write tex "\documentclass[11pt]{article}\usepackage[margin=1in]{geometry}\usepackage{booktabs}" _n
r; t=0.00 12:59:43

. file write tex "\title{Attrition between Waves}\author{Sandra Rozo}\date{\today}\begin{document}\maketitle" _n
r; t=0.00 12:59:43

. file write tex "\section{Tracking rate}" _n
r; t=0.00 12:59:43

. file write tex "Overall tracking rate: " %5.1f (100*`track_overall') "\%. " _n
r; t=0.00 12:59:43

. file write tex "PEP-RAMV: " %5.1f (100*`rate_t1') "\%; Irregular: " %5.1f (100*`rate_t0') "\%. " _n
r; t=0.00 12:59:43

. file write tex "Differential: " %4.1f (`diff_pp') " pp." _n
r; t=0.00 12:59:43

. file write tex "\section{Cutoff test}" _n
r; t=0.00 12:59:43

. file write tex "\begin{tabular}{lrr}\toprule" _n
r; t=0.00 12:59:43

. file write tex "Test & Coef & p (robust) \\\midrule" _n
r; t=0.00 12:59:43

. file write tex "Sharp ITT & " %5.3f (`sharp_b') " & " %5.3f (`sharp_p') " \\" _n
r; t=0.00 12:59:43

. file write tex "Fuzzy LATE & " %5.3f (`fuzzy_b') " & " %5.3f (`fuzzy_p') " \\\bottomrule\end{tabular}" _n
r; t=0.00 12:59:43

. file write tex "\end{document}" _n
r; t=0.00 12:59:43

. file close tex
r; t=0.00 12:59:43

. 
. di ""

r; t=0.00 12:59:43

. di "  PDF saved:    $out/08_Attrition.pdf"
  PDF saved:    ../outputs/08_Attrition.pdf
r; t=0.00 12:59:43

. di "                $out/08_Attrition_part2.pdf"
                ../outputs/08_Attrition_part2.pdf
r; t=0.00 12:59:43

. di "  TeX saved:    $out/08_Attrition.tex"
  TeX saved:    ../outputs/08_Attrition.tex
r; t=0.00 12:59:43

. di "  Done."
  Done.
r; t=0.00 12:59:43

. 
. log close
      name:  <unnamed>
       log:  C:\Users\wb614536\Downloads\replication\replication\code\../outputs/08_Attrition_log.txt
  log type:  text
 closed on:  25 Jun 2026, 12:59:43
--------------------------------------------------------------------------------------------------------------------
